<template>
	<view class="container">
		<image class="w-100" src="../../static/个人3.jpg" mode="widthFix"></image>
		<view class="content">
			<view class="card1">
				<view class="left-icon">
					<image src="../../static/鱼.png" style="width: 30px; height: 30px;"></image>
				</view>
				<view class="center-text " style="margin-left: 10px;">
					<p style="font-size: 12px;">欢迎光临</p>
					<h5 style="font-size: 8px; color: gray;">在这里遇见美味生活</h5>
				</view>
				<view class="right-button">
					<button @click="redirectToLogin" style="width: 60px; height: 20px; background: #ff0000;">
						<h5 style="font-size: 8px; color: #fffefe; ">加入会员</h5>
					</button>
				</view>
			</view>
			<view class="card2">
				<list-cell hover arrow @click="myCode">
					<view class="list-cell-wrapper">
						<view view="title">会员码</view>
						<view class="subtitle">门店扫码积分、喜茶钱包和阿喜有礼卡支持</view>
					</view>
				</list-cell>
				<list-cell hover arrow @click="myinfo">
					<view class="list-cell-wrapper">
						<view view="title">个人主页</view>
					</view>
				</list-cell>
				<list-cell hover arrow>
					<view class="list-cell-wrapper">
						<view view="title">我的订单</view>
						<view class="subtitle">点击查看我的订单</view>
					</view>
				</list-cell>
				<list-cell hover arrow>
					<view class="list-cell-wrapper">
						<view view="title">联系客服：15211111111</view>
					</view>
				</list-cell>
				<list-cell hover arrow>
					<view class="list-cell-wrapper">
						<view view="title">消息中心</view>
					</view>
				</list-cell>
				<list-cell hover arrow last>
					<view class="list-cell-wrapper">
						<view view="title">更多</view>
					</view>
				</list-cell>
			</view>
		</view>
	</view>
</template>

<script>
	import listCell from '@/components/list-cell/list-cell.vue'
	// import loginPopup from './components/login-popup.vue'
	import {
		requst_get_customerInfo,
	} from '@/api/menu.js'
	export default {
		data() {
			return {
			};
		},
		methods: {
			myinfo() {
				if (uni.getStorageSync("X-Token")) {
					requst_get_customerInfo(uni.getStorageSync("X-Token")).then(rescustomer => {
						if (rescustomer.data.data.customerId === 0) {
							uni.showToast({
								title: '请登录账号',
								icon: 'none'
							})
						}else{
							uni.setStorageSync('userInfo', rescustomer.data.data)
							uni.navigateTo({
								url: '/pages/mine/info'
							})
						}
					}).catch(err => {
						console.log('ajax_err1', err)
					})
				}else {
					uni.showToast({
						title: '请登录账号',
						icon: 'none'
					})
				}
				},
			}
		}
</script>

<style lang="scss" scoped>
	/* #ifdef H5 */
	page {
		height: auto;
		min-height: 100%;
	}

	/* #endif */

	.content {
		padding: 0 30rpx;
	}

	.welcome {
		position: relative;
		margin-top: -136rpx;
		display: flex;
		flex-direction: column;
		font-size: $font-size-lg;
		color: $text-color-warning;
	}

	image {
		width: 100%;
		height: 326rpx;
		display: inline-block;
		box-sizing: content-box
	}

	.card1 {
		display: flex;
		align-items: center;
		justify-content: space-between;
		position: absolute;
		top: 350rpx;
		/* 顶部对齐 */
		width: 90%;
		margin-left: 2%;
		// margin-right: 5%;
		height: 120rpx;
		/* 设置上半部分的高度 */
		background: white;
		border-radius: 10rpx;
		box-shadow: 5px 5px 5px #cdcfcf;
		z-index: 1;
		/* 设置一个比默认层叠顺序更高的值 */
	}

	.card2 {
		// display: flex;
		// align-items: center;
		// justify-content: space-between;
		position: absolute;
		top: 500rpx;
		/* 顶部对齐 */
		width: 90%;
		margin-left: 2%;
		// margin-right: 5%;
		height: 120rpx;
		/* 设置上半部分的高度 */
		background: white;
		border-radius: 10rpx;
		box-shadow: 5px 5px 5px #cdcfcf;
		z-index: 1;
		/* 设置一个比默认层叠顺序更高的值 */
	}

	.left-side,
	.right-side {
		flex: 1;
		/* 让左侧和右侧内容占据相同的空间 */
		margin: 0 20px;
		/* 调整左右边距 */
	}

	.left-icon {
		width: 30px;
		/* 调整图标部分的宽度 */
		height: 30px;
		/* 调整图标部分的高度 */
		border-radius: 50%;
		/* 创建圆圈效果 */
		/* 		background: #FF0000; */
		/* 设置圆圈的背景颜色 */
		display: flex;
		align-items: center;
		justify-content: center;
		margin-left: 5%;
		font-size: 15px;
		/* 调整图标的大小 */
		color: #fff;
		/* 图标的颜色 */
	}

	.center-text {
		flex: 1;
		/* 占据剩余空间 */
		font-size: 18px;
	}

	.right-button {
		width: 60px;
		/* 调整按钮部分的宽度 */
		height: 20px;
		/* 调整按钮部分的高度 */
		background: #00FF00;
		/* 设置按钮的背景颜色 */
		border-radius: 15px;
		/* 创建椭圆按钮效果 */
		display: flex;
		align-items: center;
		justify-content: center;
		margin-right: 5%;
		font-size: 14px;
		/* 调整按钮文字的大小 */
		color: #fff;
		/* 按钮文字的颜色 */
	}

	.member-card {
		background-color: $bg-color-white;
		padding: 20rpx;
		display: flex;
		flex-direction: column;
		border-radius: $border-radius-base;
		margin-bottom: 40rpx;

		.info {
			position: relative;
			margin-top: -50rpx;
			display: flex;
			align-items: center;
			position: relative;
			padding: 20rpx 0;
			border-bottom: 1rpx solid rgba($color: $border-color, $alpha: 0.3);

			.title {
				flex: 1;
				font-size: 40rpx;
				color: $text-color-base;
				display: flex;
				align-items: center;

				.tips {
					margin-left: 10rpx;
					font-size: $font-size-sm;
					color: $text-color-assist;
					background-color: #e9e9e9;
					padding: 10rpx 30rpx;
					border-radius: 50rem !important;
					display: flex;
					align-items: center;

					image {
						width: 20rpx;
						height: 20rpx;
					}
				}
			}

			.avatar {
				width: 150rpx;
				height: 150rpx;
				border-radius: 100%;
			}

			.badage {
				font-family: 'neutra';
				position: absolute;
				bottom: 20rpx;
				left: 0;
				border: 2rpx solid $text-color-base;
				padding: 2rpx 20rpx;
				border-radius: $border-radius-lg;
				font-size: $font-size-base;
			}
		}

		.row {
			margin-top: $spacing-row-base;
			width: 100%;
			display: flex;
			align-items: center;

			.grid {
				flex: 1;
				flex-shrink: 0;
				display: flex;
				flex-direction: column;
				align-items: center;

				image {
					width: 100rpx;
					height: 100rpx;
				}

				.value {
					font-family: 'neutra';
					margin-bottom: $spacing-col-sm;
					font-size: $font-size-lg;
				}

				.title {
					font-size: $font-size-sm;
					color: $text-color-grey;
				}
			}
		}
	}

	.xinqiubobao {
		width: 100%;
		position: relative;

		.title {
			margin: 10rpx 0;
			font-size: $font-size-lg;
			font-weight: 500;
		}

		.swiper {
			height: 200rpx;
			margin-bottom: 10rpx;

			.swiper-item {

				.swiper-item-wrapper {
					display: flex;
					background-color: $bg-color-white;
					padding: 40rpx 60rpx;
					border-radius: $border-radius-base;
					align-items: center;
					margin-right: 40rpx;

					image {
						width: 100rpx;
						height: 100rpx;
						border-radius: 100%;
						margin-right: 20rpx;
					}

					.desc {
						display: flex;
						flex-direction: column;

						.title {
							font-size: $font-size-medium;
							font-weight: 500;
							margin-bottom: 10rpx;
						}

						.desc {
							font-size: $font-size-sm;
							color: $text-color-grey;
						}
					}
				}
			}
		}
	}

	.task-center {
		margin: 40rpx 0;
		background-color: $bg-color-white;
		padding: 10rpx 0;
		display: flex;
		align-items: center;
		border-radius: $border-radius-lg;

		.intro {
			flex: 1;
			display: flex;
			flex-direction: column;
			justify-content: center;
			align-items: center;

			.title {
				font-size: $font-size-lg;
				color: $text-color-base;
			}

			.subtitle {
				font-family: 'neutra';
				font-size: $font-size-sm;
			}
		}

		.image-wrapper {
			flex: 1;
			display: flex;
			justify-content: center;
			align-items: center;

			image {
				width: 200rpx;
				height: 200rpx;
			}
		}
	}

	.open-gift {
		width: 100%;
		background-color: $bg-color-white;
		padding: 30rpx 40rpx;
		margin-bottom: 20rpx;

		.header {
			display: flex;
			justify-content: space-between;
			align-items: center;
			margin-bottom: 20rpx;

			.title {
				font-size: $font-size-lg;
				font-weight: 500;
			}

			.subtitle {
				font-size: $font-size-base;
				color: $text-color-grey;
			}
		}

		.row {
			display: flex;
			flex-wrap: wrap;

			.grid {
				width: 33.3333%;
				display: flex;
				flex-direction: column;
				align-items: center;
				padding: 20rpx;

				image {
					width: 70rpx;
					height: 70rpx;
					margin-bottom: $spacing-row-base;
				}

				.title {
					font-size: $font-size-base;
					color: $text-color-base;
					display: flex;
					align-items: baseline;

					.number {
						margin-left: 5rpx;
						font-family: 'neutra';
						color: $color-warning;
					}
				}
			}
		}
	}

	.list-cell-wrapper {
		width: 100%;
		display: flex;
		justify-content: space-between;
		align-items: center;

		.title {
			font-size: $font-size-lg;
		}

		.subtitle {
			font-size: $font-size-sm;
			color: $text-color-assist;
		}
	}
</style>